<template>
  <div class="wrap">
		<div class="banner">
			<mt-swipe :auto="4000">
				<mt-swipe-item>
					<img src="../../assets/image/email.jpg">
				</mt-swipe-item>
			</mt-swipe>
		</div>
		<div class="my-detail">
			<div class="my-list">
				<span class="ico ico01"></span>
				<p>办公电话：<a :href="'tel:'+inphone">{{inphone}}</a></p>
			</div>
			<div class="my-list">
				<span class="ico ico02"></span>
				<p @click="mapto">湖南省长沙市天心区木莲路与书院路交汇处东150米路北</p>
			</div>
		</div>
		<div class="input-box">
			<div class="input-list">
				<input type="text" placeholder="请输入姓名" v-model="name">
				<!-- <mt-field  placeholder="请输入姓名" v-model="name"></mt-field> -->
			</div>
			<div class="input-list">
				<input type="number" placeholder="请输入电话" v-model="phone">
				<!-- <mt-field  placeholder="请输入电话" v-model="phone"></mt-field> -->
			</div>
			<div class="input-list">
				<textarea name="" id="" cols="30" rows="4" placeholder="请输入问题描述" type="textarea" v-model="question"></textarea>
				<!-- <mt-field  placeholder="请输入问题描述" type="textarea" rows="4" v-model="question"></mt-field> -->
			</div>
			<button class="btn" @click="Submit">提交信息</button>
		</div>
  </div>
</template>

<script>
export default {
  data () {
    return {
			inphone: '',
    	name: '',
    	phone: '',
    	question: '',
			lat: ''
    }
  },
  methods: {
		getData () {
			var that = this
			that.inphone = that.$route.query.phone
			that.lat = that.$route.query.lat
		},
		mapto () {
			window.location.href = 'https://m.amap.com/navi/?dest='+this.lat+'&destName=新开铺&key=05ad08ed4721f4b9d8cd48c87c82ea1d'
		},
		Submit: function(){
			var that = this
			if (that.name === ''){
				that.$axios.messageTwo('姓名不能为空')
				return false
			}
			if (that.phone === ''){
				that.$axios.messageTwo('电话不能为空')
				return false
			}
			if (that.question === ''){
				that.$axios.messageTwo('问题不能为空')
				return false
			}
			that.$axios.request('post', '/page/question', {
					toName: '新开铺街道',
					type: 'street',
					fromId: 'aaa',
					fromPerson: that.name,
					fromPhone: that.phone,
					content: that.question
			})
				.then((res)=> {
					if(res.status === 'success') {
						that.$axios.messageTwo('提交成功')
					}
				})
		}
  },
	mounted () {
		this.getData()
	}
}
</script>

<style>
</style>
